package tech.daoxuan.signlogin.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import tech.daoxuan.signlogin.entity.User;

/**
 * @ClassName UserRepository
 * @Description TODO
 * @Author daoxuan
 * @Date 2019/4/29 12:13
 * @Version 1.0
 */
public interface UserRepository extends JpaRepository<User,Long> {

    User findUserById(long id);

    @Query(value = "select u from User u where u.username= :#{#user.username} and u.password=:#{user.password}")
    User selectUserByUsernameAndPassword(User user);

    @Query(value = "select u from  User u where u.username=:#{#user.username}")
    User selectUserByUsername(User user);
}
